import Vue from 'vue'
import VueRouter from 'vue-router'
import Reg from '@/views/Reg/Reg.vue'
import Login from '@/views/Login/Login.vue'
import Home from '@/views/Home/Home.vue'
import Welcome from '@/views/Home/Welcome.vue'

Vue.use(VueRouter)

const routes = [
  // 重定项
  {
    path: '/',
    redirect: '/Login'
  },
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
  {
    path: '/Reg',
    name: 'Reg',
    component: Reg
  },
  {
    path: '/Home',
    name: 'Home',
    component: Home,
    // 3. 开启路由重定向
    children: [
      { // 如果不写路径默认为初始路径
        path: '',
        component: Welcome
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
